<template>
  <div id="app">
    <!-- <router-view/> -->
    <h1>Survey</h1>
    <el-table
      :data="list"
      style="width: 100%">
      <el-table-column
        prop="__last_update"
        label="日期"
        width="180">
      </el-table-column>
      <el-table-column
        prop="title"
        label="名称"
        width="180">
      </el-table-column>
      <el-table-column
        prop="public_url"
        label="地址">
      </el-table-column>
      <el-table-column
        fixed="right"
        label="操作"
        width="100">
        <template slot-scope="scope">
          <el-button type="text" size="small">
            <router-link :to="{name: 'survey_question', params: {'survey_id': scope.row.id}}">开始调查</router-link>
          </el-button>
        </template>
      </el-table-column>
    </el-table>
  </div>
</template>

<script>
export default {
  name: 'App',
  data () {
    return {
      list: []
    }
  },
  mounted () {
    console.log('mounted')
    fetch('http://10.65.37.74:8080/survey/list?stage=2')
      .then(rsp => {
        rsp.json().then(data => {
          console.table(data.id)
          this.list = data
        })
      })
  }
}
</script>

<style>
#app {
  font-family: 'Avenir', Helvetica, Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-align: center;
  color: #2c3e50;
  margin-top: 60px;
}
</style>
